<div class="panel panel-box">
    <div class="panel-heading">
            <h3 class="panel-title">
                <?php echo yii::t('models/Resources','Course Resources')?>
                 <?php $params = array(
                            'teacher'=>User::model()->findByPk(yii::app()->user->id),
                            'course'=> $this->courseModel->course_id
                        );?>
               <?php if(yii::app()->user->checkAccess('admin')||yii::app()->user->checkAccess('teacher',$params)):?>
                   <span id="uploadModal" class="pull-right glyphicon glyphicon-upload" data-toggle="modal" data-target="#uploadModalBox" style="cursor:pointer"></span>
                <?php endif;?>
            </h3>
    </div>
    <ul class="list-group">
        <?php for($i = 0;$i < ((count($this->resources) > 5) ? 5 : count($this->resources));$i++):?>
        <li class="list-group-item">
        <span class="glyphicon glyphicon-download"></span>
        <a class="courseResourcesDownloadItem" data-toggle="modal" data-target="#downloadModalBox" style="cursor:pointer" 
            resources="<?php echo $this->resources[$i]->resources_id;?>" course="<?php echo $this->courseModel->course_id;?>"
            actionUrl="<?php echo yii::app()->baseUrl.'/'.yii::app()->controller->id.'/'.yii::app()->controller->getAction()->getId();?>">
                <?php $elem = $this->resources[$i]->getCourseResourceModel($this->courseModel->course_id);?>
                <?php echo CHtml::encode($elem->title);?>
            </a>
        </li>
        <?php endfor;?>
    </ul>
</div>

<!-- upload modal content--!>
<div class="modal fade" id="uploadModalBox" tabindex="-1" role="dialog" aria-labelledby="mymodallabel" aria-hidden="true">
  <div class="modal-dialog" style="width:50%;margin-top:4%">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title" id="mymodallabel"><?php echo yii::t('models/Resources','Course Resources Upload');?></h4>
      </div>
      <div class="modal-body">
        <form role="form" enctype="multipart/form-data" method="post">
          <div class="form-group">
            <label><?php echo yii::t('models/Resources','Title');?>: </label>
            <input type="text" name="title" class="form-control info"></input>
          </div>
          <div class="form-group">
            <label><?php echo yii::t('models/Resources','Content');?>: </label>
            <textarea id="resourceContent" name="content">
            </textarea>
     	    <script type="text/javascript">
            var editor = new UE.ui.Editor({
                  toolbars:[['undo','redo','RowSpacing','FontFamily','FontSize','insertimage', 'emotion', 'scrawl']]
            });
			    editor.render("resourceContent");
            </script>
          </div>
          <div class="form-group">
                <input type="file" id="resource_upload" name="resourceFile"/>
          </div>
           <div class="text-right">
                <button type="submit" class="btn btn-primary" name="Upload">
                    <?php echo yii::t('other/Site','Upload');?>
                </button>
                <button type="button" class="btn btn-default" data-dismiss="modal">
                    <?php echo yii::t('other/Site','Close');?>
                </button>
            </div>
        </form>
      </div>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal -->

<!-- download modal content--!>
<div class="modal fade" id="downloadModalBox" tabindex="-1" role="dialog" aria-labelledby="mymodallabel" aria-hidden="true">
  <div class="modal-dialog" style="width:50%;margin-top:4%">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title" id="mymodallabel"><?php echo yii::t('models/Resources','Course Resources Download');?></h4>
      </div>
      <div class="modal-body">
        <div class="jumbotron">
            <h3 id="downloadTitle">123</h3>
            <span id="downloadContent"></span>
            <form method="post">
            <p><button name="Download" id="downloadButton" type="submit" class="pull-right btn btn-primary btn-lg" role="button">Download</button></p>
            </form>
        </div>
      </div>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal -->


